﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name = 'Goal')
	BEGIN
		DROP  Table Goal
	END
GO

CREATE TABLE Goal
(
   GoalId int not null identity (1,1),
   AccountId int not null,
   CreatedOn datetime not null,
   KeyIndicator nvarchar(2) not null,
   TargetValue float not null,
   TargetDate datetime null,
   DecreaseTo bit not null,
   AchievedOn datetime null,
   Active bit not null
   
   constraint pkGoal primary key (GoalId),
   constraint fkGoalToAccount foreign key (AccountId) references Account (AccountId),
   constraint ckGoalTargetValue check (TargetValue > 0)
)
GO   